package com.example.contactapp;

import java.io.Serializable;

public class Contact implements Comparable<Contact>, Serializable {

    private Integer id;
    private String name;
    private String address;
    private String phone;
    private Integer age;
    private String interests;
    private char firstLetter;

    public Contact(Integer id, String name, String address, String phone, Integer age, String interests) {
        this.id = id;
        this.name = name;
        this.address = address;
        this.phone = phone;
        this.age = age;
        this.interests = interests;
        this.firstLetter = name.charAt(0);
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getInterests() {
        return interests;
    }

    public void setInterests(String interests) {
        this.interests = interests;
    }
    public char getFirstLetter() {
        return firstLetter;
    }

    @Override
    public String toString() {
        return "Contact{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", address='" + address + '\'' +
                ", phone='" + phone + '\'' +
                ", age=" + age +
                ", interests='" + interests + '\'' +
                '}';
    }

    public int compareTo(Contact other) {
        return this.name.compareTo(other.name);
    }
}